package com.accessibleworlds.blind;

/**
 * Defines a location that can be spoken on a blind interface.
 * @author Ayberk Özgür
 *
 */
public class BlindLocation implements Comparable<BlindLocation>{
	private double distance;
	private double latitude;
	private double longitude;
	private String spokenName;
	private boolean alertedUserFar = false;
	private boolean alertedUserNear = false;

	public BlindLocation(String spokenName, double distance, double latitude, double longitude) {
		this.spokenName = spokenName;
		this.distance = distance;
		this.latitude = latitude;
		this.longitude = longitude;
	}
	
	public String getSpokenString(){
		return "There is a " + spokenName + " within " + (int)distance + " meters from you.";
	}

	public double getDistance(){
		return distance;
	}

	public void updateDistance(double distance){
		this.distance = distance;
	}
	
	public int compareTo(BlindLocation another) {
		if(distance > another.distance)
			return 1;
		else if(distance < another.distance)
			return -1;
		else
			return 0;
	}

	public void alertUserFar(){
		alertedUserFar = true;
	}

	public boolean isUserAlertedFar(){
		return alertedUserFar;
	}
	
	public void alertUserNear(){
		alertedUserNear = true;
	}

	public boolean isUserAlertedNear(){
		return alertedUserNear;
	}

	public double getLatitude() {
		return latitude;
	}

	public double getLongitude() {
		return longitude;
	}
}
